<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断时间段</title>
    <script>
        var time = prompt(`现在是几点钟:`);
        if ( time>24) {
             alert(`请输入一个小于24的数！！`)
        }
        else if (time < 12 && time>=8) {
            alert(`早上好！`);
        }
        else if (time == 12) {
            alert(`中午好！`);
        }
        else if (time > 12 && time < 18) {
            alert(`下午好！`);
        }
        else if (time == 18) {
            alert(`傍晚好！`);
        }
        else if (time>18 && time < 23) {
          alert(`晚上好！`);

        }
        else {
                alert(`深夜好！`);
        }

    </script>
</head>

<body>

</body>

</html>